/*
 * Library to encrypt and decrypt a string
 * Used for file encoding/decoding as required in assignment
 * Source is online, so no testing required
 */

#ifndef ENCRYPTIONLIB_H
#define	ENCRYPTIONLIB_H

#include <string>

using namespace std;

string encryptDecrypt(string toEncrypt) {
    char key[3] = {'K', 'C', 'Q'}; //Any chars will work, in an array of any size
    string output = toEncrypt;

    for (int i = 0; i < toEncrypt.size(); i++)
        output[i] = toEncrypt[i] ^ key[i % (sizeof (key) / sizeof (char))];

    return output;
}

#endif	/* ENCRYPTIONLIB_H */

